<%@page import="cn.lily.com.enviroment.Enviroment"%>
<%@page import="app.portal.dao.Pt_app_infoBean"%>
<%@page import="app.portal.dao.Pw_app_operBean"%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ page import="cn.lily.inst.web.frames.FrameConfig"%>
<%@ page import="cn.lily.web.util.context.WebContext"%>
<%@ page import="cn.lily.esb.context.AuthEntity"%>
<%@page import="app.portal.util.UtilMethod"%>
<%@page import="cn.lily.com.db.sql.DBManager"%>
<%@page import="cn.lily.com.db.DBFactory"%>
<%@page import="cn.lily.com.db.container.reader.DataTable"%>
<%@ include file="/frames/logbegin.jsp" %>
<%
	String contextPath = "";
	String app_oper_no="";
	String app_oper_pwd="";
	String app_oper_no_nam="";
	String app_oper_pwd_nam="";
	String app_path="";
	
	AuthEntity authEntity = (AuthEntity) session.getAttribute(WebContext.LOG_AUTH_CONTEXT);
	if (authEntity != null) {
		contextPath = authEntity.getContextPath();
	}
	FrameConfig.setContextPath(contextPath);
	//应用id
	String pw_app_id = request.getParameter("pw_app_id");
	//系统id
	String app_id = request.getParameter("app_id");
	//获取某个系统的url缓存
	app_path =(String)session.getAttribute(app_id);
	if(app_path==null ||"".equals(app_path)){
		app_path=UtilMethod.getUrl(app_id);
		if(!"0".equals(app_path)) {        
			session.setAttribute(app_id, app_path);
		}else {
			System.out.print("未获取到有效的url！");
		}
	}
	Pt_app_infoBean app_infoBean=new Pt_app_infoBean().findBean(" where app_id='"+app_id+"'");
	if(app_infoBean!=null) {
		app_oper_no_nam=app_infoBean.getApp_oper_no_nam();
		app_oper_pwd_nam=app_infoBean.getApp_oper_pwd_nam();
	}else {
		app_oper_no_nam="username";
		app_oper_pwd_nam="password";
	}
	Pw_app_operBean app_operBean=new Pw_app_operBean().findBean(" where pw_app_id='"+pw_app_id+"' and oper_key='"+authEntity.getOperatorId()+"'");
	if(app_operBean!=null && !"0".equals(app_path)){
		app_oper_no=app_operBean.getApp_oper_no();
		app_oper_pwd=app_operBean.getApp_oper_pwd();
		if(app_infoBean!=null) {
			app_path+=app_infoBean.getApp_path();
		}
	}
%>
<%@ include file="/frames/logend.jsp" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="<%=FrameConfig.getBaseJsUrl() %>/common/jquery-1.9.1.min.js"></script>

</head>
<body>
	<form id="loginFrom" action="<%=app_path %>" method="post">
		<input type="hidden" id="userName" name="<%= app_oper_no_nam%>" value="<%=app_oper_no %>" /> 
		<input type="hidden" id="userPwd" name="<%=app_oper_pwd_nam %>" value="<%=app_oper_pwd %>" />
	</form>
	<script type="text/javascript">
		$(function(){
			$("#loginFrom").submit();
		}) 
	</script>
</body>
</html>

